#include <iostream>
using namespace std;

typedef struct Node{
    int data;
    Node* prev;
    Node* next;
} Node;

typedef struct {
    Node* head;
    Node* tail;
    int length;
} List;

void initList(List* list){
    list->length = 0;
    list->head = NULL;
    list->tail = NULL;
}

void append(List* list,int elem){
    Node* newnode = new Node();
    newnode->data = elem;
    // first init
    if(list->length == 0){
        newnode->prev = NULL;
        newnode->next = NULL;
        list->head = newnode;
        list->tail = newnode;
    }else{
        newnode->prev = list->tail;
        newnode->next = NULL;
        list->tail->next = newnode;
        list->tail = newnode;
    }
    list->length++;
}

void showList(List* list){
    Node* node = list->head;
    cout<<"the size is "<<list->length<<endl;
    while (node->next != NULL)
    {
        cout<<node->data<<endl;
        node = node->next;
    }

}

void showListReverse(List* list){
    
}
int main(){
    List* list = new List();
    initList(list);
    append(list,1);
    append(list,2);
    append(list,3);
    // append(list,4);
    // append(list,5);
    // append(list,6);
    showList(list);


}